{{- $categories := slice -}}
{{- range .GetTerms "categories" -}}
  {{- $categories = $categories | append (
    printf `<a href="%v" class="post-category" title="%v">%v %v</a>`
    (partial "function/escapeurl.html" .RelPermalink)
    (printf "%v - %v" (T "category") .LinkTitle)
    (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html")
    .LinkTitle
  ) -}}
{{- end -}}
{{- $categoriesStr := delimit $categories "&ensp;" -}}

{{- $collections := slice -}}
{{- range .GetTerms "collections" -}}
  {{- $collections = $collections | append (
    printf `<a href="%v" class="post-collection" title="%v">%v %v</a>`
    (partial "function/escapeurl.html" .RelPermalink)
    (printf "%v - %v" (T "collection") .LinkTitle)
    (dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html")
    .LinkTitle
  ) -}}
{{- end -}}
{{- $collectionStr := delimit $collections "&ensp;" -}}

{{- if .Params.categories | or .Params.collections -}}
  <span class="post-included-in">
    {{- if not .Params.collections -}}
      &nbsp;{{- dict "Categories" $categoriesStr | T "single.includedIn.categories" | safeHTML -}}
    {{- else if not .Params.categories -}}
      &nbsp;{{- dict "Collections" $collectionStr | T "single.includedIn.collections" | safeHTML -}}
    {{- else -}}
      &nbsp;{{- dict "Categories" $categoriesStr "Collections" $collectionStr | T "single.includedIn.both" | safeHTML -}}
    {{- end -}}
  </span>
{{- end -}}
